<template>
    <a-modal
            :title="tableTitle"
            :visible="visible"
            width="1200px"
            @ok="handleOk"
            :maskClosable="false"
            :confirmLoading="confirmLoading"
            @cancel="handleCancel"
    >
        <a-form-model ref="form" :model="form">
            <a-descriptions bordered :column="2">
                <a-descriptions-item label="活动名称">
                    <a-form-model-item>
                        <a-input
                                :maxLength="100"
                                :placeholder="'请输入活动名称'"
                                v-model="form.activityName">
                        </a-input>
                    </a-form-model-item>
                </a-descriptions-item>
                <a-descriptions-item label="活动日期">
                    <a-form-model-item>
                        <xlDate
                                :min="0"
                                :placeholder="'请输入载体成立时间'"
                                v-model="form.activityDate">
                        </xlDate>
                    </a-form-model-item>
                </a-descriptions-item>

                <a-descriptions-item label="活动类型">
                    <a-form-model-item>
                        <a-input
                                :maxLength="100"
                                :placeholder="'请输入运营机构'"
                                v-model="form.activityType">
                        </a-input>
                    </a-form-model-item>
                </a-descriptions-item>
                <a-descriptions-item label="参加人数">
                    <a-form-model-item>
                        <a-input-number
                                :maxLength="100"
                                :placeholder="'请输入运营机构'"
                                v-model="form.paticipateNum">
                        </a-input-number>
                    </a-form-model-item>
                </a-descriptions-item>
                <a-descriptions-item label="活动日程描述" :span="2">
                    <a-form-model-item>
                        <ueditor
                                :min="0"
                                :placeholder="'请输入场地面积'"
                                v-model="form.durationTime">
                        </ueditor>
                    </a-form-model-item>
                </a-descriptions-item>
                <a-descriptions-item label="附件" :span="2">
                    <a-form-model-item>
                        <xluploadFile v-model="form.materialPath"></xluploadFile>
                    </a-form-model-item>
                </a-descriptions-item>
            </a-descriptions>
        </a-form-model>
    </a-modal>
</template>

<script>
    import xlDate from '../../../../../components/formUntil/xlDate'
    import xlImage from '../../../../../components/formUntil/xlImage'
    import xluploadFile from '../../../../../components/formUntil/xluploadFile'
    import xlImages from '../../../../../components/formUntil/xlImages'
    import ueditor from '../../../../../components/ueditor'

    import {carrierActivityAdd} from '@/assets/api'
    export default {
        name: "xlForm",
        data() {
            return {
                tableTitle: '编辑',
                visible: false,
                confirmLoading: false,
                form: {},
                rules: {}, 
                carrierId:''
            }
        },
        components: {
            xlDate,
            xlImage,
            xluploadFile,
            xlImages,
            ueditor
        },
        methods: {
            handleOk() {
                this.$refs.form.validate(valid => {
                    console.log(valid)
                    if (valid) {
                        this.form.carrierId = this.carrierId
                        carrierActivityAdd(
                            {param:this.form}
                        ).then(result => {
                            console.log(result)
                        })
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            },
            handleCancel() {
                this.visible = false
            },
            formatForm(form) {
                delete form.createDateTime
                delete form.modifyDateTime
                delete form.modifyBy
                delete form.createBy
                //整理字段数据 ／ 赋值 清空等
                this.carrierId = form.id
                console.log(form,12121212)
            }
        }
    }
</script>

<style scoped lang="less">
    /deep/ .ant-form-item {
        margin: 0;
    }

    /deep/ .ant-input-number {
        width: 100%;
    }

    .xl-dateRange {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .ant-checkbox-group {
        display: flex;
        flex-wrap: wrap;

        .xl-checkbox {
            display: flex;
            align-items: center;

            /deep/ span:nth-child(2):not(.ant-checkbox-inner) {
                display: flex;
                justify-content: space-between;
                white-space: pre;
            }
        }
    }
</style>
